﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Automapping;
using FluentNHibernate.Automapping.Alterations;
using Peak.Core;

namespace Peak.Data.NHibernateMaps
{
  public class SprintStoryMap : IAutoMappingOverride<SprintStory>
  {
    public void Override(AutoMapping<SprintStory> mapping)
    {
      mapping.Id(x => x.Id, "id").UnsavedValue(0).GeneratedBy.Identity();
      mapping.Map(x => x.CurrentEffort);
      mapping.Map(x => x.OpenedTaskCount);
      mapping.Map(x => x.RemainingEffort);
      mapping.Map(x => x.StoryPoints);      
      mapping.References(x => x.Story);
      mapping.References(x => x.Sprint);
      mapping.HasMany(x => x.Tasks).Cascade.All();            
    }
  }
}